
/**
 * 1.student,cards都必须引入生命周期符号，否则会报错,即使它们都只有一个引用属性
 */
#[derive(Debug)]
struct student<'a>{
    name: &'a str,
    age: i32,
}
#[derive(Debug)]
enum cars<'a>{
    byd(&'a str),
}
/**
 * 这个函数要不要加生命周期符号都无所谓，结果是一样的
 */
fn print_str(s:&str)->&str{
    s
}

fn print_str1<'a>(s:&'a str)->&'a str{
    s
}

fn print_str_and_enum(car:cars,stu:student){
    println!("{:?}",car);
    println!("{:?}",stu);
}

fn main() {
    let s = student {
        name: "Tom",
        age: 18,
    };
    let s1 = print_str(s.name);
    println!("{}",s1);
    let byd_song=cars::byd("song");
    print_str_and_enum(byd_song,s);
}



